/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rockpaperscissors;

import java.util.Scanner;

/**
 *
 * @author Anne
 */
public class RockPaperScissors {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String p1, p2;
        Scanner keyboard = new Scanner(System.in);
        boolean noWinner = true;
        boolean playAgain = true;

        while (noWinner == true || playAgain == true) {

            // p1 && p2 will be one of '(r p s)
            System.out.println("Player 1");
            System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
            System.out.println("R: rock");
            System.out.println("P: paper");
            System.out.println("S: scissors");
            System.out.println("Paper covers rock, Rock breaks scissors, Scissors cut paper!!");

            p1 = keyboard.next();
            p1 = p1.toUpperCase();

            System.out.println("Player 2");
            System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
            System.out.println("R: rock");
            System.out.println("P: paper");
            System.out.println("S: scissors");
            System.out.println("Paper covers rock, Rock breaks scissors, Scissors cut paper!!");

            p2 = keyboard.next();
            p2 = p2.toUpperCase();

            noWinner = false; // Juan, set noWinner to allow testing my code.
            //Method call to check if player 1 wins. 
            //Method call to check if player 2 wins
            //No Winner to the game - automatic replay
            
            if (noWinner == false) {

                System.out.println("Would you like to play again?))");
                System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
                System.out.println("y: Yes");
                System.out.println("N: No");

                String answer = keyboard.next();
                answer = answer.toUpperCase();

                if (answer.equals("Y")) {
                    playAgain = true;
                } else {
                    playAgain = false;
                }
            }

        }

    }
}
